package 第1节循环语句;

import java.util.Scanner;

public class LianXi05 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int num1 = input.nextInt();
        int num2 = input.nextInt();

        int minValue = Math.min(num1, num2);

        for (int i = minValue; i >= 1; i--) {
            if (num1 % i == 0 && num2 % i == 0) {
                System.out.println(i);
                break;
            }
        }

    }
}
